package com.cyf.util;

import lombok.Data;

/**
 * 普通的返回（业务用到）
 *
 * @author hfy
 * @date 2018/11/23
 */
@Data
public final class CommonRsp {

    private static final int STATUS_OK = 1;
    private static final int STATUS_FAIL = 0;

    private static final CommonRsp OK = new CommonRsp(STATUS_OK, "");
    private int status;
    private String strError;

    private CommonRsp(int status, String strError) {
        this.status = status;
        this.strError = strError;
    }

    public static CommonRsp ok() {
        return OK;
    }

    public static CommonRsp fail(String strError) {
        return new CommonRsp(STATUS_FAIL, strError);
    }

    public boolean isOk() {
        return this.status == STATUS_OK;
    }
}
